home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
miscnix.zip
/
STRNCHR.A
< prev
next >
Wrap
Text File
|
1988-05-20
|
493b
|
29 lines
;STRNCHR - Search for matching character.
; char *strnchr(addr: address; len: integer; pat: char);
; This is like strchr (=index) except that it works with fixed length
; strings.
cseg
public strnchr_
strnchr_:pop bx
pop di ;start address
pop cx ;length
pop ax ;character to match
push ax
push cx
push di
push bx
cld
push ds
pop es
jcxz s1 ;if not found
repne scasb
jne s1 ;if not found
dec di ;if found, back up
s1: xchg ax,di
ret
end